package study.getage;

import java.util.Scanner;

/**
 * @author huan
 */
public class Application {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入你的生日（格式：1992-05-05）：");
        String birthday = sc.nextLine();
        Application application = new Application();
        application.methodTotal(birthday);
    }

    /**
     * 方法体
     *
     * @param birthday 生日
     */
    private void methodTotal(String birthday) {
        GetAge getAge = new GetAge();
        Scanner sc = new Scanner(System.in);
        int a;
        do {
            System.out.println("请选择需要查询的内容：");
            System.out.println("1.**********周岁**********");
            System.out.println("2.**********虚岁**********");
            System.out.println("3.*********距今天数********");
            System.out.println("4.*********距今月数********");
            System.out.println("5.*****已经经过的分钟数******");
            System.out.println("6.****距离你活XX岁的时间*****");
            System.out.println("7.******看看你的星座吧*******");
            System.out.println("8.******看看你的生肖吧*******");
            System.out.println("9.**********退出***********");
            int select = Integer.parseInt(sc.nextLine());
            switch (select) {
                case 1:
                    int fullAge = getAge.fullAge(birthday);
                    System.out.println("您的周岁是：" + fullAge);
                    a = 1;
                    break;
                case 2:
                    int shamAge = getAge.shamAge(birthday);
                    System.out.println("您的虚岁是：" + shamAge);
                    a = 1;
                    break;
                case 3:
                    long gapDay = getAge.gapDay(birthday);
                    System.out.println("您距今天数是：" + gapDay);
                    a = 1;
                    break;
                case 4:
                    long gapMonth = getAge.gapMonth(birthday);
                    System.out.println("您距今月数是：" + gapMonth);
                    a = 1;
                    break;
                case 5:
                    long gapMin = getAge.gapMin(birthday);
                    System.out.println("您距今活过的分钟数是：" + gapMin);
                    a = 1;
                    break;
                case 6:
                    System.out.println("输入您想查询的岁数：");
                    String targeAge = sc.nextLine();
                    do {
                        System.out.println("输入您想查询的选择：");
                        System.out.println("1.*****天数*****：");
                        System.out.println("2.****分钟数****：");
                        System.out.println("3.***返回上一层***：");
                        int minOrDay = Integer.parseInt(sc.nextLine());
                        switch (minOrDay) {
                            case 1:
                                long targetDay = getAge.getTime(birthday, targeAge);
                                System.out.println("您距离：" + targeAge + "岁还剩：" + targetDay + "天");
                                a = 3;
                                break;
                            case 2:
                                long getMin = getAge.getMin(birthday, targeAge);
                                System.out.println("您距离：" + targeAge + "岁还剩：" + getMin + "分钟");
                                a = 3;
                                break;
                            case 3:
                                a = 2;
                                break;
                            default:
                                System.out.println("请输入一个年龄");
                                a = 2;
                                break;
                        }
                    } while (a == 3);
                    a = 1;
                    break;
                case 7:
                    String zodiac = getAge.zodiac(birthday);
                    System.out.println("您的星座是：" + zodiac);
                    a = 1;
                    break;
                case 8:
                    String chineseZodiac = getAge.chineseZodiac(birthday);
                    System.out.println("您的生肖是：" + chineseZodiac);
                    a = 1;
                    break;
                case 9:
                    a = 2;
                    break;
                default:
                    System.out.println("不知道输入什么了吗？选择恐惧症又犯了吗？那我帮你选一个");
                    a = 2;
                    break;
            }
        } while (a == 1);

        System.out.println("谢谢您的参与");
    }
}
